using UnityEngine;
using System.Collections;

public class PunMgr : MonoBehaviour {

    public GameObject manager;
    int displayedStageNum;
    float timeLeft = 0.0f;

	// Use this for initialization
	void Start () {
        displayedStageNum = 0; //Don't display on first screen
	}
	
	// Update is called once per frame
	void Update () {
        GameManager man = manager.GetComponent<GameManager>();
        if (man.currentStageComplete && man.currentStage > displayedStageNum)
        {
            renderer.enabled = true;
            GetComponent<Animatable>().SetFrame(Random.Range(0, 23), 0);
            displayedStageNum = man.currentStage;
            timeLeft = 2.0f;
        }
        timeLeft -= Time.deltaTime;
        if (timeLeft <= 0)
        {
            renderer.enabled = false;
        }
	}
}
